package com.yl.demo.base.config.shiro;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionIdGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;
import java.util.UUID;

/**
 * Created by YL on 2019/10/17.
 * 自定义sessionId生成
 */

public class CustomSessionIdGenerator implements SessionIdGenerator {

    private final static Logger logger = LoggerFactory.getLogger(MyShiroRealm.class);

    @Override
    public Serializable generateId(Session session) {
        String sessionId = "juedream"+ UUID.randomUUID().toString().replace("-","");
        logger.info("自定义sessionId============["+sessionId+"]");
        return sessionId;
    }
}
